my_set = {"Buider", "Alice", 1, 1, '1', False}
print(my_set)

#添加元素
my_set.add("Bob")
my_set.add("Buider")#only one buider in fact

#移除元素
my_set.remove("Alice")
# my_set.remove(("Buider"))

print(my_set)

#随机取一个
result = my_set.pop()
print(result)
print(my_set)

#差集
set1 = {1, 5 ,6}
set2 = {2, 5 ,6}
result = set1.difference(set2)
print(result)

#消除差集 - 消除相同的
set1 = {1, 2 ,3}
set2 = {1, 5 ,6}
set1.difference_update(set2)
print(set1)
print(f"{set2}")

#合并
set1 = {1, 2 ,3}
set2 = {1, 5 ,6}
set3 = set1.union(set2)
print(set3)

#统计元素个数
num = len(set3)
print(num)

#遍历
for i in set3:
    print(f"element:{i}", end = ' ')

# #清空
# my_set.clear()
# print(my_set)

